package com.admin.dao;

import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.admin.bean.AdminIvrStatFeeBean;

@Repository
public class AdminIvrStatFeeDao {

	
	@Autowired private QueryRunner queryRunner;
	
	
	
	public List<AdminIvrStatFeeBean> findStatByCondition(String condition)  throws SQLException{
		final String sql = "select dt,gatewayid as spid, channel as cpid,calluser,callnum,calltime,statfee,cpcalluser,cpcallnum,cpcalltime,cpstatfee,province" +
		" from T_ivr_stat_fee "+ condition;
//System.out.println(sql);
		return queryRunner.query(sql, new BeanListHandler<AdminIvrStatFeeBean>(AdminIvrStatFeeBean.class),new Object[]{});
	}
	
	
	public List<AdminIvrStatFeeBean> findHourStatByCondition(String condition)  throws SQLException{
		final String sql = "select dt,gatewayid as spid, channel as cpid,calluser,callnum,calltime,statfee,cpcalluser,cpcallnum,cpcalltime,cpstatfee,province" +
		" from T_ivr_stat_fee_detail "+ condition;
System.out.println(sql);
		return queryRunner.query(sql, new BeanListHandler<AdminIvrStatFeeBean>(AdminIvrStatFeeBean.class),new Object[]{});
	}
}
